package com.api.shopapi.mapper;


import com.api.shopapi.entity.MedicationSchedulingMorningItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface MedicationSchedulingMorningItemMapper {

    @Insert("insert into medication_scheduling_morning_item " +
            "(MedicationSchedulingMorningItemCode,MedicationSchedulingMorningCode,Name) " +
            "values (#{medicationSchedulingMorningItem.MedicationSchedulingMorningItemCode} ,#{medicationSchedulingMorningItem.MedicationSchedulingMorningCode} ,#{medicationSchedulingMorningItem.Name} )")
    int insert(@Param("medicationSchedulingMorningItem") MedicationSchedulingMorningItem medicationSchedulingMorningItem);

    @Update("update medication_scheduling_morning_item set MedicationSchedulingMorningCode=#{medicationSchedulingMorningItem.MedicationSchedulingMorningCode} ,Name=#{medicationSchedulingMorningItem.Name} " +
            "where medicationSchedulingMorningItemCode=#{medicationSchedulingMorningItem.medicationSchedulingMorningItemCode}  ")
    int updateByMedicationSchedulingMorningItemCode(@Param("medicationSchedulingMorningItem") MedicationSchedulingMorningItem medicationSchedulingMorningItem);

    @Delete("delete from medication_scheduling_morning_item where MedicationSchedulingMorningItemCode=#{medicationSchedulingMorningItemCode} ")
    int deleteByMedicationSchedulingMorningItemCode(@Param("medicationSchedulingMorningItemCode") String medicationSchedulingMorningItemCode);

    @Select("select * from medication_scheduling_morning_item where MedicationSchedulingMorningItemCode=#{medicationSchedulingMorningItemCode} limit 1")
    MedicationSchedulingMorningItem getByMedicationSchedulingMorningItemCode(@Param("medicationSchedulingMorningItemCode")String medicationSchedulingMorningItemCode);

    @Select("select * from medication_scheduling_morning_item where MedicationSchedulingMorningCode=#{medicationSchedulingMorningCode}")
    List<MedicationSchedulingMorningItem> getListByMedicationSchedulingMorningCode(@Param("medicationSchedulingMorningCode")String medicationSchedulingMorningCode);

    @Delete("delete from medication_scheduling_morning_item where MedicationSchedulingMorningCode=#{medicationSchedulingMorningCode} ")
    int deleteByMedicationSchedulingMorningCode(String medicationSchedulingMorningCode);
}
